package com.cplatform.movie.back.order.entity;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import net.sf.json.JSONObject;

/**
 * 订单实体类,一个商品一个订单
 * <p>
 * @author 左天宇
 * <p>
 * @package com.z.item.entity
 * <p>
 * @time 下午3:45:27 2015年6月6日
 */
@Entity
@Table(name="t_small_shop_order")
public class Order {
	
	/**
	 * 订单id
	 */
	@SequenceGenerator(name = "seq_item", sequenceName = "SEQ_SMALL_SHOP_SEQ")
	@Id
	@GeneratedValue(generator = "seq_item")
	private Long id;
	
	/**
	 * 总价
	 */
	@Column(precision=10,name="total_price")
	private double totalPrice;
	
	
	/**
	 * 配送地址
	 */
	private String address;

	/**
	 * 创建时间
	 */
	@Column(length=14,name="create_time")
	private String createTime;
	
	/**
	 * 订单状态 0-未支付，1-已支付，2-过期
	 */
	@Column(length=1,name="order_status")
	private Long orderStatus;

	
	/**
	 * 使用红包名
	 */
	private String redPackageName;
	
	/**
	 * 使用红包id
	 */
	private Long redPackageId;
	
	/**
	 * 使用积分数量
	 */
	private double integral;
	
	/**
	 * 使用积分id
	 */
	private Long integralId;
	
	/**
	 * 实际付款金额
	 */
	private double realPayPrice;
	
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
	}


	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public Long getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(Long orderStatus) {
		this.orderStatus = orderStatus;
	}
	
	
	public String getRedPackageName() {
		return redPackageName;
	}

	public void setRedPackageName(String redPackageName) {
		this.redPackageName = redPackageName;
	}

	public double getIntegral() {
		return integral;
	}

	public void setIntegral(double integral) {
		this.integral = integral;
	}

	public double getRealPayPrice() {
		return realPayPrice;
	}
	
	public void setRealPayPrice(double realPayPrice) {
		this.realPayPrice = realPayPrice;
	}
	
	public Long getRedPackageId() {
		return redPackageId;
	}

	public void setRedPackageId(Long redPackageId) {
		this.redPackageId = redPackageId;
	}

	public Long getIntegralId() {
		return integralId;
	}

	public void setIntegralId(Long integralId) {
		this.integralId = integralId;
	}

	@Transient
	private String createEndTime; // 订单创建结束时间
	
	public String getCreateEndTime() {
		return createEndTime;
	}

	public void setCreateEndTime(String createEndTime) {
		this.createEndTime = createEndTime;
	}

	@Override
	public String toString() {
		return JSONObject.fromObject(this).toString();
	}
}
